QT       += core gui network

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++17
DESTDIR = ./bin #所有生成的可执行文件和其他输出文件都将被放置在这个目录中
# RC_ICONS = icon.ico

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    chatdialog.cpp \
    chatuserlist.cpp \
    chatuserwid.cpp \
    clickedbtn.cpp \
    clickedlabel.cpp \
    customizelineedit.cpp \
    global.cpp \
    httpmgr.cpp \
    listitembase.cpp \
    loadingdialog.cpp \
    logindialog.cpp \
    main.cpp \
    mainwindow.cpp \
    registerdialog.cpp \
    resetdialog.cpp \
    tcpmanager.cpp \
    timerbtn.cpp \
    usermanager.cpp

HEADERS += \
    chatdialog.h \
    chatuserlist.h \
    chatuserwid.h \
    clickedbtn.h \
    clickedlabel.h \
    customizelineedit.h \
    global.h \
    httpmgr.h \
    listitembase.h \
    loadingdialog.h \
    logindialog.h \
    mainwindow.h \
    netglobal.h \
    registerdialog.h \
    resetdialog.h \
    singleton.h \
    tcpmanager.h \
    timerbtn.h \
    usermanager.h

FORMS += \
    chatdialog.ui \
    chatuserwid.ui \
    loadingdialog.ui \
    logindialog.ui \
    mainwindow.ui \
    registerdialog.ui \
    resetdialog.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

RESOURCES += \
    rc.qrc

DISTFILES += \
    config.ini

#将 config.ini 拷贝到 DESTDIR 设置的目录
win32:CONFIG(debug, debug | release)
{
    #获取 config.ini 文件的目录  -  PWD：获取当前工作目录
    TargetConfig = $${PWD}/config.ini

    #在Windows中，要将输入目录中的"/"替换为"\" - 许要转义
    TargetConfig = $$replace(TargetConfig, /, \\)

    #设置输出目录为bin,上面设置过
    OutputDir =  $${OUT_PWD}/$${DESTDIR}
    OutputDir = $$replace(OutputDir, /, \\)

    #将当前目录下的config.ini文件复制到输出目录（./bin）中
    #QMAKE_POST_LINK 表示  该命令在链接过程完成后执行
    #/Y参数表示在覆盖目标文件时不提示确认
    QMAKE_POST_LINK += copy /Y \"$$TargetConfig\" \"$$OutputDir\"
}
